home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c++
- Subject: Re: Difficulty hiring people with C++ experience.
- Date: 10 Jan 1996 21:00:55 GMT
- Organization: Computer People Inc.
- Message-ID: <ALUN.CHAMPION.96Jan10160055@g7240065.bridge.bst.bls.com>
- References: <gmandelDJAoyx.Kpr@netcom.com> <4ai727$of3@nrchh52.rich.nt.com>
- <4api46$c95@no-names.nerdc.ufl.edu> <4bto2d$gnq@usenet1.interramp.com>
- <gmandelDKL1AF.K22@netcom.com> <4clu0d$623@usenet4.interramp.com>
- <4d12p3$26lq@news.doit.wisc.edu>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: keiter@hp-171.cae.wisc.edu's message of 10 Jan 1996 19:07:15 GMT
-
- In article <4d12p3$26lq@news.doit.wisc.edu> keiter@hp-171.cae.wisc.edu (Eric Richard Keiter) writes:
-
- : (Tom Donaldson) writes:
- :: When asked about
- :: "programming by contract", the response is "Huh?" The
- :: difference between dynamic and static languages? "Static
- :: languages shock you if you shuffle your feet, and dynamic
- :: languages are more energetic?" What are your professional
- :: development goals for the next five years? "To have a job and
- :: have lots of free time to play Sega games."
-
- : I'm curious... what IS the difference between dynamic and static
- : languages? is it that a dynamic language allows for dynamic memory
- : allocation? or allows aliases?
-
- Its to do with the typing mechanisms of the particular language.
-
- In C++ (statically typed language with dynamic binding) restricts polymorphic
- capabilities to come from a common base class, with virtual specifier on the
- member functions. This unnecessary on a dynamic typed language.
-
- Example:
- In static typed C++
-
- class Common
- {
- public:
- virtual void someFunction(void) = 0;
- };
-
- class Polymorph1 : public Common
- {
- public:
- virtual void someFunction(void);
- };
-
- class Polymorph2 : public Common
- {
- public:
- virtual void someFunction(void);
- };
-
- void func(Common& param)
- {
- param.someFunction();
- }
-
- Same thing in dynamic typed C++
-
- class Polymorph1
- {
- public:
- virtual void someFunction(void);
- };
-
- class Polymorph2
- {
- public:
- virtual void someFunction(void);
- };
-
- // No type needed for param - determined at runtime (dynamically)
- void func(param)
- {
- param.someFunction(); // Function invocation determine on the dynamic
- } // type of param
-
- Does this clarify things ?
-
- : and what is programming by contract? it sounds like an obvious question
- : -- is the answer not obvious?
-
- The contract between the user and its supplier is the set of requests that
- a user can make of that supplier. Programming by contract is the focus
- of ensuring the supplier fulfils its contracts. Some aspects of the user
- contract is enforced by the compiler like making methods private or protected
- but the ability to grant access for particular classes is not possible at the
- moment, so some reliance is on the user of the class to not break its contract
- with the supplier.
- In a multi-threaded environment its very hard to guarentee the contract between
- user and supplier because the guarentee of the supplier can be broken by
- another thread i.e. values changed etc.. In these situations you lock the
- supplier so it can guarentee the contract for the period of that lock.
-
- Hope this helps
- Regards
-
- -A.
- --
- | A.Champion |
-